export const showToast = (title: string) => {
  uni.showToast({ title, icon: 'none', mask: true });
};

export const showError = (title: string) => {
  if (title.length > 6) {
    uni.showModal({
      title: '提示',
      content: title,
      showCancel: false,
    });
  } else {
    uni.showToast({ title, icon: 'error', mask: true });
  }
  throw new Error(title);
};

export const showSuccess = (title: string) => {
  uni.showToast({ title, icon: 'success', mask: true });
};

export default {
  showToast,
  showError,
  showSuccess,
};
